package com.jukte.recipe;

import com.ewhat.recipes.R;
import com.jukte.recipe.db.DataBaseManager;
import com.jukte.recipe.models.Ingredient;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.Window;
import android.widget.EditText;

public class AddMoreDialogActivity extends Activity {
	EditText txt_text;
	int recipe_id;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.dialog_addmore);
		//getWindow().setBackgroundDrawableResource(R.drawable.ios_top_button);
		//getWindow().setFeatureDrawableResource(Window.FEATURE_NO_TITLE, android.R.drawable.ic_dialog_alert)

		txt_text=(EditText)findViewById(R.id.editText1);
		
		Intent in=getIntent();
		recipe_id=in.getIntExtra("recipe_id", -1);
	}

	public void onClickAdd(View v)
	{
		Ingredient in=new Ingredient();
		in.setText(txt_text.getText().toString());
		in.setRecipe_id(recipe_id);
		DataBaseManager.getInstance().AddCustomIngredient(in);
		
		DataBaseManager.getInstance().closeDb();
		finish();
	}
	
	public void onClose(View v)
	{
		finish();
	}
}
